package com.yong.sbd.biz.file.config.properties;

import jakarta.validation.constraints.Positive;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;


/**
 * 文件存储配置
 *
 * @author Kang Yong
 * @date 2025/10/24
 * @since 1.0.0
 */
@RefreshScope
@Data
@Configuration
@ConfigurationProperties(prefix = "file.storage")
public class FileStorageProperties {

    private String location;

    private String allowedExtensions = "jpg,jpeg,png,gif,pdf,doc,docx,xls,xlsx,txt,zip,rar";

    private ThumbnailConfig thumbnail = new ThumbnailConfig();

    @Data
    public static class ThumbnailConfig {
        private boolean enabled = true;

        @Positive(message = "缩略图宽度必须为正数")
        private Integer width = 200;

        @Positive(message = "缩略图高度必须为正数")
        private Integer height = 200;
    }

}
